package sggJuc.future;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

/**
 *  Future接口常用实现类FutureTask异步任务
 */
public class FuTureTest {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask threadFuture = new FutureTask(new ThreadFuture());
        new Thread(threadFuture,"t1").start();
        System.out.println(threadFuture.get());
    }

}
class ThreadFuture implements Callable {
    @Override
    public Object call() throws Exception {
        return "hello ThreadFuture";
    }
}